package com.bocloud.cmp.interfaces.resource;

import java.util.List;
import java.util.Map;

import com.bocloud.cmp.entity.resource.Server;
import com.bocloud.cmp.model.RackDevice;
import com.bocloud.cmp.model.ServerBean;
import com.bocloud.common.model.BsmResult;
import com.bocloud.common.model.Param;

/**
 * 主机抽象Service接口
 * 
 * @author wei wei
 * @version 1.0
 * @since 2016.02.27
 */
public interface ServerService {

	/**
	 * 添加主机
	 * 
	 * @param pServer
	 *            the pServer
	 * @return the result
	 */
	public BsmResult create(Server pServer, Long userId);

	/**
	 * 更新主机
	 * 
	 * @param bean
	 *            the bean
	 * @param userId
	 *            the user id
	 * @return the result
	 */
	public BsmResult modify(ServerBean bean, Long userId);

	/**
	 * 逻辑删除主机
	 * 
	 * @param id
	 *            the id
	 * @param id
	 *            the user id
	 * @return the result
	 */
	public BsmResult remove(Long id, Long userId);

	/**
	 * 查询主机详细
	 * 
	 * @param id
	 *            the id
	 * @return the result
	 */
	public BsmResult basic(Long id);

	/**
	 * 查询主机列表
	 * 
	 * @param page
	 *            the page
	 * @param rows
	 *            the rows
	 * @param params
	 *            the params
	 * @param sorter
	 *            the sorter
	 * @param simple
	 *            the simple
	 * @return the result
	 */
	public BsmResult list(int page, int rows, List<Param> params, Map<String, String> sorter, Boolean simple);

	/**
	 * 得到当前主机的基本信息和统计信息
	 * 
	 * @param id
	 *            the id
	 * @return the result
	 */
	public BsmResult detail(Long id);

	/**
	 * 放入机柜
	 * 
	 * @param rackDevice
	 *            the rackDevice
	 * @param id
	 *            the user id
	 * @return the result
	 */
	public BsmResult inRack(RackDevice rackDevice, Long userId);

	/**
	 * 移出机柜
	 * 
	 * @param id
	 *            the server id
	 * @param userId
	 *            the user id
	 * @return the result
	 */
	public BsmResult outRack(Long id, Long userId);

	/**
	 * 查询空闲主机列表
	 * 
	 * @return the result
	 */
	public BsmResult freePMs();

	/**
	 * 启动主机
	 * 
	 * @param id
	 *            the id
	 * @param id
	 *            the user id
	 * @return the result
	 */
	public BsmResult start(Long id, Long userId);

	/**
	 * 关闭主机
	 * 
	 * @param id
	 *            the id
	 * @param id
	 *            the user id
	 * @return the result
	 */
	public BsmResult stop(Long id, Long userId);

	/**
	 * 重启主机
	 * 
	 * @param id
	 *            the id
	 * @param id
	 *            the user id
	 * @return the result
	 */
	public BsmResult restart(Long id, Long userId);

	/**
	 * 隔离主机
	 * 
	 * @param id
	 *            the id
	 * @param id
	 *            the user id
	 * @return the result
	 */
	public BsmResult isolate(Long id, Long userId);

	/**
	 * 恢复主机
	 * 
	 * @param id
	 *            the id
	 * @param id
	 *            the user id
	 * @return the result
	 */
	public BsmResult recover(Long id, Long userId);

	/**
	 * 查看IP是否存在
	 * 
	 * @param ip
	 *            the manage ip
	 * @return the result
	 */
	public BsmResult exists(String ip);

	/**
	 * 通过IP查询当前主机信息
	 * 
	 * @author sxp
	 * @since V1.0 Nov 4, 2016
	 */
	public Server detail(String ip);

	/**
	 * 当前主机的操作系统是否为Windows
	 * 
	 * @author sxp
	 * @since V1.0 Nov 4, 2016
	 */
	public boolean isWindowsPlatform(Long id);

	/**
	 * 获取所有物理主机的uuid和ip
	 * <p>
	 * 使用SNMP自动发现采集对象时使用
	 * </p>
	 * 
	 * @author sxp
	 * @since V1.0 Dec 5, 2016
	 */
	public List<Map<String, String>> getAll4Snmp();

	/**
	 * 物理机批量启动
	 * 
	 * @param params
	 * @param userId
	 * @return
	 */
	public BsmResult batchStart(String params, Long userId);

	/**
	 * 物理机批量停止
	 * 
	 * @param parms
	 * @param userId
	 * @return
	 */
	public BsmResult batchStop(String params, Long userId);

	/**
	 * 物理机批量删除
	 * 
	 * @param params
	 * @param userId
	 * @return
	 */
	public BsmResult batchRemove(String params, Long userId);
}
